package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import com.boot.security.server.dto.appregmarkDto;
import com.boot.security.server.dto.appremkDto;
import com.boot.security.server.model.AppZdDoctor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppRegsterMark;

@Mapper
public interface AppRegsterMarkDao {

    @Select("select * from app_regster_mark t where t.id = #{id}")
    AppRegsterMark getById(Long id);

    @Delete("delete from app_regster_mark where id = #{id}")
    int delete(Long id);

    int update(AppRegsterMark appRegsterMark);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_regster_mark(regsterpayid, hostcode, titletype, title, count, doctor, doctorcode, fee, reghour, reghalf, specialty, remark, extparam1, extparam, deptcode, deptname, marktype, cliniclabel, registerway, flagused, flagavailable, clinicposition, clinicfee, appointcount, regcount, dqcode) values(#{regsterpayid}, #{hostcode}, #{titletype}, #{title}, #{count}, #{doctor}, #{doctorcode}, #{fee}, #{reghour}, #{reghalf}, #{specialty}, #{remark}, #{extparam1}, #{extparam}, #{deptcode}, #{deptname}, #{marktype}, #{cliniclabel}, #{registerway}, #{flagused}, #{flagavailable}, #{clinicposition}, #{clinicfee}, #{appointcount}, #{regcount}, #{dqcode})")
    int save(AppRegsterMark appRegsterMark);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppRegsterMark> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
    @Select("select * from app_regster_mark t where t.hostcode = #{hostcode} or  t.deptcode = #{deptcode} or  t.doctorcode = #{doctorcode} ")
    List<AppRegsterMark> getBylist(@Param("hostcode") String hostcode, @Param("deptcode") String deptcode, @Param("doctorcode") String doctorcode);
    @Select("select * from app_regster_mark t where t.hostcode = #{hostcode} or  t.deptcode = #{deptcode} or  t.doctorcode = #{doctorcode} or  t.deptcode1 = #{deptcode1}  or  t.deptcode2 = #{deptcode2}  ")
    List<appregmarkDto> getBydtolist(@Param("hostcode") String hostcode, @Param("deptcode") String deptcode, @Param("doctorcode") String doctorcode,@Param("deptcode1") String deptcode1,@Param("deptcode2") String deptcode2);



}
